From 81c452f998a0cafbca47b350e521a62cc7014d6a Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Fri, 9 Mar 2007 02:32:52 +0000 Subject: [PATCH] Make the VTPM.destroy method return 'void' upon success and adapt the test case to reflect that. Signed-off-by: Stefan Berger --- tools/python/xen/xend/XendAPI.py | 2 +- tools/xm-test/tests/vtpm/09_vtpm-xapi.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index 69ebb3f341..c89f5467d0 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -1926,7 +1926,7 @@ class XendAPI(object): XendDomain.POWER_STATE_NAMES[dom.state]]) from xen.xend.server import tpmif tpmif.destroy_vtpmstate(dom.getName()) - return xen_api_success(True) + return xen_api_success_void() else: return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']]) diff --git a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py b/tools/xm-test/tests/vtpm/09_vtpm-xapi.py index 6a17c51045..6de28805d3 100644 --- a/tools/xm-test/tests/vtpm/09_vtpm-xapi.py +++ b/tools/xm-test/tests/vtpm/09_vtpm-xapi.py @@ -113,7 +113,7 @@ if not re.search("PCR-00:",run["output"]): FAIL("1. Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"]) try: - rc = session.xenapi.VTPM.destroy(vtpm_uuid) + session.xenapi.VTPM.destroy(vtpm_uuid) #Should never get here FAIL("Could destroy vTPM while VM is running") except: @@ -124,7 +124,7 @@ if rc: FAIL("Could not suspend VM") try: - rc = session.xenapi.VTPM.destroy(vtpm_uuid) + session.xenapi.VTPM.destroy(vtpm_uuid) #May not throw an exception in 'suspend' state except: pass @@ -150,8 +150,9 @@ if not re.search("PCR-00:",run["output"]): domain.stop() -rc = session.xenapi.VTPM.destroy(vtpm_uuid) -if not rc: +try: + session.xenapi.VTPM.destroy(vtpm_uuid) +except: FAIL("Could NOT destroy vTPM while domain is halted.") domain.destroy() -- 2.30.2